package com.shengqin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.shengqin.entity.SummaryArchive;
import com.shengqin.entity.SummaryGraduation;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface SummaryArchiveMapper extends BaseMapper<SummaryArchive> {
    @Select("select t.* from (select id,school_name,plan_name,sex,study_code,address,birthday,nation,name,grade_id,classes_name,total_score,school_year,\n" +
            "create_by,create_time,update_by,update_time from t_summary_archive where school_year=#{schoolYear}-1 \n" +
            "union all\n" +
            "select id,school_name,plan_name,sex,study_code,address,birthday,nation,name,grade_id,classes_name,total_score,school_year,\n" +
            "create_by,create_time,update_by,update_time from t_summary_archive where school_year=#{schoolYear}-2 \n" +
            "union all\n" +
            "select id,school_name,plan_name,sex,study_code,address,birthday,nation,name,grade_id,classes_name,total_score,school_year,\n" +
            "create_by,create_time,update_by,update_time from t_summary_archive where school_year=#{schoolYear}-3 \n" +
            "union all\n" +
            "select id,school_name,plan_name,sex,study_code,address,birthday,nation,name,grade_id,classes_name,total_score,school_year,\n" +
            "create_by,create_time,update_by,update_time from t_summary_archive where school_year=#{schoolYear}-4 ) t\n" +
            " order by t.name,t.study_code")
    List<SummaryArchive> getTotalScore(@Param("schoolYear")Integer schoolYear);
}
